#coding:utf-8
import argparse
import os
import PyUnitReport

from common.task import create_task

def main():
    """ parse command line options and run commands.
    """
    parser = argparse.ArgumentParser(
        description='interface test')
    parser.add_argument(
        'testset_paths', nargs='*',
        help="testset file path")

    args = parser.parse_args()

    args.testset_paths = ["testsets\\add_department.yml"]

    for testset_path in args.testset_paths:

        testset_path = testset_path.strip('/')
        task_suite = create_task(testset_path)

        output_folder_name = os.path.basename(os.path.splitext(testset_path)[0])
        kwargs = {
            "output": output_folder_name,
            "report_name": None,
            "failfast": False
        }
        PyUnitReport.HTMLTestRunner(**kwargs).run(task_suite)
